package com.ruoyi.syf.service;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.syf.domain.TCPSocketEscalationDataRes;

import java.util.List;
import java.util.Map;

public interface EscalationService {

    /**
     * 政府Socket上报
     */
    boolean socketEscalation(List<Map<String,Object>> data,String escalationType);

    /**
     * 园区Socket上报
     */
    boolean socketYQEscalation(List<Map<String, Object>> data, String escalationType);

    /**
     * http上报
     */
    boolean httpEscalation(List<Map<String,Object>> data,String escalationType);

    /**
     * 重新上报
     * @param id 日志ID
     */
    boolean reEscalation(Long id) throws IllegalAccessException;

    /**
     * 处理socket响应
     */
    default TCPSocketEscalationDataRes socketRes(String res) {
        if (res != null && res.length() > 0){
            return JSON.parseObject(res, TCPSocketEscalationDataRes.class);
        }
        return null;
    }

}
